<template>
  <swiper>
    <swiper-item v-for="item in banners" :key="item.title">
      <a :href="item.link">
        <img :src="item.image" alt="" @load="imageLoad">
      </a>
    </swiper-item>
  </swiper>
</template>

<script>
import { swiper, swiperItem } from 'components/common/swiper/index'

export default {
  name: "home_swiper",
  props: {
    banners: {
      type: Array,
      default() {
        return []
      }
    }
  },
  components: {
    swiper,
    swiperItem
  },
  methods: {
    // 图片加载好时，向父组件发送事件
    imageLoad() {
      this.$emit('swiperImageLoad');
    }
  }
}
</script>

<style scoped>

</style>